﻿import React from 'react';
import 
{ 
    Form,
    message, 
    Modal,
    @{antComponentName}
} 
from 'antd';

interface Props
{
    modalVisible: boolean;
    onSubmit: () => void;
    onCancel: () => void;
    id?:number;
}

const CreateModal: React.FC<Props> = (props) =>
{
    const { modalVisible, onSubmit, onCancel } = props;
    const [form] = Form.useForm();
    form.resetFields();
    @{for(variable in variableList)}@{variable}
    @{end}

    const saveRecord = async ()=>{
    }

    return (
     <Modal
      width={700}
      destroyOnClose
      title="新建"
      open={modalVisible}
      onCancel={() => onCancel()}
      footer={[
        <Button key="submit" onClick={()=>{ saveRecord(); onSubmit?.()}} type="primary">
          保存
        </Button>,
        <Button key="back" onClick={()=>{ onCancel?.() }} >
          取消
        </Button>,
      ]}
    >
      <Form
        name="basic"
        labelCol={{ span: 4 }}
        wrapperCol={{ span: 18 }}
        style={{ maxWidth: 600 }}
        form={form}
        initialValues={{ remember: true }}
        autoComplete="off"
      >
            @{for(str in componentHtmlList)} @{str} 
            @{end}
      </Form>
    </Modal>
            );
}

export default CreateModal;